package com.gitee.zeric.codec.generaters;


import com.alibaba.fastjson.JSONObject;

public interface CodeGenerater {

    /**自增缓存*/
    String REDIS_DB_INCRMENT_CODE_RULE_PREFIX = "zcode:incrment:";
    /**规则缓存*/
    String REDIS_DB_CODE_RULE_PREFIX = "zcode:rule:";
    /**临时规则缓存*/
    String REDIS_TMP_CODE_RULE_PREFIX = "zcode:tmpRule:";

    /**
     * 嵌套编码生成
     * @author zj
     * @date 2021/12/21 16:11
     * @param ruleCode
     * @param jsonObject
     * @return java.lang.String
     */
    String generateCode(String ruleCode, JSONObject jsonObject);

    /**
     * 默认生成实现接口
     * @author zj
     * @date 2021/12/20 14:53
     * @param ruleCode
     * @param jsonObject
     * @return java.lang.String
     */
     String generate(String ruleCode,JSONObject jsonObject);

     int size(JSONObject paramJson);

     /**
      * 校验参数实现接口
      * @author zj
      * @date 2021/12/20 14:56
      * @param paramJson
      */
    void checkParam(JSONObject paramJson);

     default <T extends RuleParam> T trans(Class<T> ruleParamClass, JSONObject jsonObject){
         return jsonObject.toJavaObject(ruleParamClass);
     }

}
